﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NIKE_Project.BLL;

namespace NIKE_ProjectTests.KZJ
{
    [TestClass]
    public class UnitTestSalaryAccountingServer
    {
        private readonly SalaryAccountingServer Server = new SalaryAccountingServer();
        /// <summary>
        /// 测试根据姓名和角色筛选数据
        /// </summary>
        [TestMethod]
        public void TestGetSalesManData()
        {
            var ds=Server.GetSalesManData("k", "导购员");
            var rowCount = ds.Rows.Count;
            Assert.AreEqual(1, rowCount);
        }
        /// <summary>
        /// 测试通过联系方式获取导购员ID
        /// </summary>
        [TestMethod]
        public void TestGetSalesManIdByMobile()
        {
            var count = Server.GetSalesManIdByMobile("13544641641");
            Assert.AreEqual("7", count);
        }
        /// <summary>
        /// 测试计算 导购员月销售额 = 本月度导购员经手的销售金额总和 
        /// </summary>
        [TestMethod]
        public void TestGetSumShopAmount()
        {
            var ds = Server.SumShopAmount(DateTime.Now, DateTime.Now, "4");
            var rowCount = ds.Tables.Count;
            Assert.AreEqual(1, rowCount);
        }
        /// <summary>
        /// 测试计算 店长月度销售额 = 店内所有导购员月度销售总和 - 当月销售额考核保底
        /// </summary>
        [TestMethod]
        public void TestSumManagerAmount()
        {
            var ds = Server.SumManagerAmount(DateTime.Now, DateTime.Now);
            var rowCount = ds.Tables.Count;
            Assert.AreEqual(1, rowCount);
        }
    }
}
